package com.kould.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kould.annotation.CacheEntity;
import com.kould.common.base.KMapper;
import com.kould.enity.Archive;
import com.kould.enity.Article;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@CacheEntity(Article.class)
public interface KacheArticleMapper extends KMapper<Article> {

    @Select("SELECT year(create_time) as year,month(create_time) as month,count(*) as count " +
            "FROM klog_article " +
            "GROUP BY year(create_time),month(create_time) " +
            "LIMIT #{start},#{end}")
    List<Archive> listArchives(@Param("start") Long start, @Param("end") Long end);
}
